package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealCheckgroupMapper {
    /**
     * 根据套餐id查询检查组
     * @param setmealId
     * @return
     */
    @Select("select checkgroup_id from t_setmeal_checkgroup where setmeal_id=#{setmealId}")
    List<Integer> list(Integer setmealId);

    /**
     * 根据检查组查询对应套餐
     * @param checkgroupId
     * @return
     */
    @Select("select setmeal_id from t_setmeal_checkgroup where checkgroup_id=#{checkgroupId}")
    List<Integer> readsteam(Integer checkgroupId);

    /**
     * 删除对应套餐关联信息
     * @param id
     */
    @Delete("delete from t_setmeal_checkgroup where checkgroup_id=#{id}")
    void delectcheckgroup(Integer id);

    /**
     * 根据套餐删除关联表
     * @param setmealId
     */
    @Delete("delete from t_setmeal_checkgroup where setmeal_id=#{setmealId}")
    void delectsetmeal(Integer setmealId);

    /**
     * 插入关联表
     * @param setmealId
     * @param checkGroupId
     */
    @Insert("insert into t_setmeal_checkgroup (setmeal_id, checkgroup_id) VALUES (#{setmealId},#{checkGroupId})")
    void insert(Integer setmealId, Integer checkGroupId);
}
